package Server.Dwc.cqssc;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Vector;

import net.sf.json.*;
import redis.protocal.DbInfoMgr;
import redis.protocal.DwcRedisRecord;
import redis.protocal.UserRedisInfo;
import robot.GoldMgr;
import robot.Robot;
import robot.RobotMgr;
import Server.Agent.CHttpClient;
import Server.Agent.GameDB;
import Server.Model.Base.IRoom;
import Server.Model.Base.IServerUserItem;
import Server.Model.Base.SHMUser;
import Server.Model.Hall.QpGameMgr;
import Server.Model.Hall.dthall;
import admin.AdminRedis;
import club.ClubRedis;
import common.routine.CommonDef;
import common.routine.PublishDef;
import Server.Model.Base.SecShmUser;
import Server.Model.Base.UserGoldChange;
import Server.Model.Base.UserRmbChange;

class CqsscBenQiInfo{
	String m_danHao;
	String m_curStage;
	// 1:stage_tingpan
	// 2:stage_fengpan
	// 3:stage_xiazhu
	// 4:stage_kaijiang
	// 5:stage_finish
	CqsscTimeConfig m_config;
	int[] m_kaiResult = new int[5];
	int m_sum;
	String m_daXiao;
	String m_danShuang;
	String m_longHuHe;
	String m_nn;
	int m_requestCount = 0;
	int m_nextRequestTime = 0;
}
class CqsscTimeConfig{
	String m_index;
	int m_xiaZhuTime;
	int m_fengPanTime;
	int m_kaiJiangTime;
}
public class CqsscTable extends IRoom {
	@Override
	public int GetID() {
		return m_dwTableID;
	};

	@Override
	public int GetCreator() {
		// TODO Auto-generated method stub
		return m_Creator;
	}

	@Override
	public String GetType() {
		return "CQSSC";
	};

	@Override
	public void OnClientClose(int uid) {
		OnUserStandUp(uid, false);
	};

	public boolean SendData(int wChairID, String sData) {
		if (wChairID == Constants.INVALID_CHAIR) {
			for (short i = 0; i < m_pIUserItem.length; i++) {
				if (m_pIUserItem[i].dwUserID > 0) {
					if (m_pIUserItem[i].isAndroidUser == 0) {
						dthall.getInstance().onSend(m_pIUserItem[i].dwUserID, sData);
					} else {
					}
				}
			}
			return true;
		} else {
			if (wChairID >= m_pIUserItem.length) {
				dthall.getInstance().onSend(wChairID, sData);
			} else if (m_pIUserItem[wChairID].dwUserID > 0) {
				if (m_pIUserItem[wChairID].isAndroidUser == 0) {
					dthall.getInstance().onSend(m_pIUserItem[wChairID].dwUserID, sData);
				} else {
				}
				return true;
			}
		}

		return false;
	}

	int m_dwLastDoCmdTime;

	public int CanSit(int _Uid) {
		if (m_locked != 0) {
			return 13;
		}

		for (int i = 0; i < m_maxUserNum; i++) {
			if (m_pIUserItem[i].dwUserID == _Uid) {
				SUBCMD_S_OnLine cmd = new SUBCMD_S_OnLine();
				cmd.uid = _Uid;
				cmd.seat = i;
				SendData(Constants.INVALID_CHAIR, cmd.getJsonData());
				return i;
			}
		}

		SHMUser user = dthall.getInstance().getUserInfo(_Uid);

		if (user != null && isGoldType()) {
			if (user.getCoin(0) < m_ruchang) {
				return 21;
			}
		}
		if (user != null && isDwcType()) {
			if (user.getCoin(0) < m_ruchang) {
				return 21;
			}
		}

		for (int i = 0; i < m_maxUserNum; i++) {
			if (m_pIUserItem[i].dwUserID == 0) {
				return 1;
			}
		}
		return 12;
	};

	Long m_lStartTime;
	long needDealTime;
	int m_dwTableID;
	long m_dismissTimer;

	boolean m_bGameStarted;
	boolean m_bTableStarted;
	int m_byRound;
	int m_byMaxRound;
	int m_wFaPaiDelay;

	public String m_payWay;
	public String m_strParam;
	public String m_strRoomDesc;
	public String[] m_vecParam;

	public int m_byZhuang;

	GameLogic m_GameLogic = new GameLogic();
	CqsscBenQiInfo m_currCqssc = null;//为空则表明系统停盘中的间隔
	CqsscBenQiInfo m_prevCqssc = null;
	String m_requestUrl = GoldMgr.getInstance().getCqsscRequestUrl();
	JSONObject m_peiLvConfig = GoldMgr.getInstance().getCqsscPeiLvConfig();
	int m_locked = 0;
	public int m_maxUserNum = 1000;// 这个值随便调节,1000因为单台服务器查询控制，避免查询过于频繁，导致被封
	IServerUserItem m_pIUserItem[] = new IServerUserItem[m_maxUserNum];
	{
		for (int i = 0; i < m_maxUserNum; i++) {
			m_pIUserItem[i] = new IServerUserItem();
		}
	}
	//遍历的时候遍历此数据
	public Map<Integer, Integer> m_allChairs = new HashMap<Integer, Integer>();
	public void addChairUser(int uid, int seatId) {
		m_allChairs.put(uid, seatId);
	}

	public void removeChairUser(int uid) {
		if (m_allChairs.containsKey(uid)) {
			m_allChairs.remove(uid);
		}
	}

	public Map<Integer,List<JSONObject>> m_benQiZhuDan = new HashMap<Integer,List<JSONObject>>();
	void saveZhuDanIntoRedis(){
		//保存并清除,状态输赢均已被处理过，直接存储
		DwcRedisRecord dwc = DwcRedisRecord.getInstance();
		dwc.addCqsscDayXiaZhuLog(m_benQiZhuDan);
		m_benQiZhuDan.clear();
	}
	void addBenQiZhuDan(int uid,double needfund,int difen,String data){
		JSONObject json = new JSONObject();
		json.put("uid", uid);
		json.put("time", UserRedisInfo.getRecordTimeKey());
		json.put("needfund", needfund);
		json.put("difen", difen);
		json.put("data", data);
		json.put("won", 0.0);
		json.put("qihao", m_currCqssc.m_danHao);
		json.put("kaijiang", "0,0,0,0,0");
		json.put("status", 0);//0:等待开奖,1:开奖结束 2:作废
		if(m_benQiZhuDan.containsKey(uid)){
			m_benQiZhuDan.get(uid).add(json);
		}else{
			List<JSONObject> value = new ArrayList<JSONObject>();
			value.add(json);
			m_benQiZhuDan.put(uid, value);
		}
	}
	public int m_Creator;

	int[] m_UserStatus = new int[m_maxUserNum];
	int UserCntReady = 0;
	long startDealTime = 30;
	int m_needRobotNum = 0;
	int m_openWaitTime = 0;
	List<CqsscTimeConfig> m_timeConfigs = new ArrayList<CqsscTimeConfig>();
	CqsscTable() {
		m_bTableStarted = false;
		m_lStartTime = System.currentTimeMillis() / 1000;
		m_bRemove = false;
		m_payWay = "FZPAY";
		m_strParam = "";
		m_strRoomDesc = "";
	}
	Map<String,Double> m_zhuNames = new HashMap<String,Double>();
	public IServerUserItem getRandRobot() {
		int robotcount = 0;
		for (int i = 0; i < m_maxUserNum; i++) {
			if (m_pIUserItem[i].dwUserID > 0 && m_pIUserItem[i].isAndroidUser == 2) {
				robotcount++;
			}
		}
		int index = random(0, robotcount);
		int count = 0;
		for (int i = 0; i < m_maxUserNum; i++) {
			if (m_pIUserItem[i].dwUserID > 0 && m_pIUserItem[i].isAndroidUser == 2) {
				if (count == index) {
					return m_pIUserItem[i];
				}
				count++;
			}
		}
		return null;
	}

	void Init(int cbReason) {
		m_dwLastDoCmdTime = 0;
		m_bGameStarted = false;
		m_wFaPaiDelay = 0;
		UserCntReady = 0;
		startDealTime = 30;
		if (cbReason == Constants.INIT_TOTAL) {
			setRoomStarted(true);// 设置为开始状态
			currDealTime = 1;
			JSONObject jsonTime = GoldMgr.getInstance().getCqsscTimeContorl();
			int kaiJiangDealy = GoldMgr.getInstance().getCqsscTimeDelay();
			int touzhutiqian = GoldMgr.getInstance().getCqsscTouZhuTiQian();
			//遍历处理时间节点
			Iterator iterator = jsonTime.keys();
			int currIndex = 1;
			while(iterator.hasNext()){
				String key = (String) iterator.next();
				String value = jsonTime.getString(key);
				Integer keyIndex = Integer.parseInt(key);
				String[] timesep = value.split(":");
				int startHour = Integer.parseInt(timesep[0]);
				int startMin = Integer.parseInt(timesep[1]);
				//开奖前20分钟开始可投注
				CqsscTimeConfig config = new CqsscTimeConfig();
				if(currIndex < 10){
					config.m_index = "00" + currIndex;
				}else{
					config.m_index = "0" + currIndex;
				}
				currIndex++;
				int time = startHour * 3600 + startMin * 60;
				//time += kaiJiangDealy;
				//这个是标准时间，加上各种延迟进去
				config.m_xiaZhuTime = time + kaiJiangDealy - touzhutiqian;
				config.m_fengPanTime = time - 30;//提前30秒封盘
				config.m_kaiJiangTime = time + kaiJiangDealy;
				m_timeConfigs.add(config);
			}
			initOnCurrTime();
			initXiaZhuName();
			//开始处理上一期数据
			handleOnInitRequestData();
		}
	}
	void handleOnInitRequestData(){
		//系统启动处理数据
		CHttpClient http = new CHttpClient();
		if(m_currCqssc != null)
			m_currCqssc.m_nextRequestTime = (int) (System.currentTimeMillis() / 1000);
		String rev = http.requestHttpInfo(m_requestUrl);
		if(rev == null){
			return; //啥也不做
		}
		if(m_currCqssc == null){
			m_prevCqssc = new CqsscBenQiInfo();
			//封盘期间
			JSONObject obj = JSONObject.fromObject(rev);
			m_prevCqssc = new CqsscBenQiInfo();
			JSONArray data = obj.optJSONArray("retData");
			//取一个
			JSONObject obj0 = data.getJSONObject(0);
			String WinningNumber = obj0.optString("WinningNumber");
			m_prevCqssc.m_danHao = WinningNumber;
			String result = obj0.optString("WinningNumbers");
			String [] nums = result.split(",");
			for(int i = 0;i < 5;i++){
				m_prevCqssc.m_kaiResult[i] = Integer.parseInt(nums[i]);
			}
			CalculrPrevKaiJiang();
		}else{
			m_prevCqssc = new CqsscBenQiInfo();
			JSONObject obj = JSONObject.fromObject(rev);
			JSONArray data = obj.optJSONArray("retData");
			//取一个
			JSONObject obj0 = data.getJSONObject(0);
			String WinningNumber = obj0.optString("WinningNumber");
			String result = obj0.optString("WinningNumbers");
			long winNum = Long.parseLong(WinningNumber);
			long currNum = Long.parseLong(m_currCqssc.m_danHao);
			if(winNum == currNum - 1){
				//这就是前一期的
				String [] nums = result.split(",");
				for(int i = 0;i < 5;i++){
					m_prevCqssc.m_kaiResult[i] = Integer.parseInt(nums[i]);
				}
				m_prevCqssc.m_danHao = WinningNumber;
				CalculrPrevKaiJiang();
			}else if(winNum == currNum){
				//去第二个
				obj0 = data.getJSONObject(1);
				WinningNumber = obj0.optString("WinningNumber");
				result = obj0.optString("WinningNumbers");
				String [] nums = result.split(",");
				for(int i = 0;i < 5;i++){
					m_prevCqssc.m_kaiResult[i] = Integer.parseInt(nums[i]);
				}
				m_prevCqssc.m_danHao = WinningNumber;
				CalculrPrevKaiJiang();
			}else{
				m_prevCqssc = null;//找不到数据啥也不做
			}
		}
	}
	void CalculrPrevKaiJiang(){
		m_prevCqssc.m_sum = 0;
		for(int i = 0;i < 5;i++){
			m_prevCqssc.m_sum += m_prevCqssc.m_kaiResult[i];
		}
		if(m_prevCqssc.m_sum >= 23){
			m_prevCqssc.m_daXiao = "大";
		}else{
			m_prevCqssc.m_daXiao = "小";
		}
		if(m_prevCqssc.m_sum % 2 == 0){
			m_prevCqssc.m_danShuang = "双";
		}else{
			m_prevCqssc.m_danShuang = "单";
		}
		if(m_prevCqssc.m_kaiResult[0] > m_prevCqssc.m_kaiResult[4]){
			m_prevCqssc.m_longHuHe = "龙";
		}else if(m_prevCqssc.m_kaiResult[0] < m_prevCqssc.m_kaiResult[4]){
			m_prevCqssc.m_longHuHe = "虎";
		}else{
			m_prevCqssc.m_longHuHe = "和";
		}
		String[] nius = {"没牛","牛一","牛二","牛三","牛四","牛五","牛六","牛七","牛八","牛九","牛牛"};
		int niutype = getNiu(m_prevCqssc.m_kaiResult);
		m_prevCqssc.m_nn = nius[niutype];
	}
	void initXiaZhuName(){
		m_zhuNames.put("总和大", m_peiLvConfig.optDouble("lm_zong"));
		m_zhuNames.put("总和小", m_peiLvConfig.optDouble("lm_zong"));
		m_zhuNames.put("总和单", m_peiLvConfig.optDouble("lm_zong"));
		m_zhuNames.put("总和双", m_peiLvConfig.optDouble("lm_zong"));
		m_zhuNames.put("龙", m_peiLvConfig.optDouble("lm_longhu"));
		m_zhuNames.put("虎", m_peiLvConfig.optDouble("lm_longhu"));
		m_zhuNames.put("和", m_peiLvConfig.optDouble("lm_he"));
		String[] nums = {"一","二","三","四","五"};
		for(int i = 0;i < 5;i++){
			m_zhuNames.put("第" + nums[i] + "球大", m_peiLvConfig.optDouble("lm_dxds"));
			m_zhuNames.put("第" + nums[i] + "球小", m_peiLvConfig.optDouble("lm_dxds"));
			m_zhuNames.put("第" + nums[i] + "球单", m_peiLvConfig.optDouble("lm_dxds"));
			m_zhuNames.put("第" + nums[i] + "球双", m_peiLvConfig.optDouble("lm_dxds"));
		}
		for(int i = 0;i < 5;i++){
			for(int k = 0;k < 10;k++){
				m_zhuNames.put("第" + nums[i] + "球" + k, m_peiLvConfig.optDouble("ball1_5"));
			}
		}
		String[] qzhs = {"前三 ","中三 ","后三 "};
		String[] qzhkexuan = {"豹子","顺子","对子","半顺","杂六"};
		Double[] qzhpeilv = {m_peiLvConfig.optDouble("qzh_baozi"),m_peiLvConfig.optDouble("qzh_shunzi"),
				m_peiLvConfig.optDouble("qzh_duizi"),m_peiLvConfig.optDouble("qzh_banshun"),
				m_peiLvConfig.optDouble("qzh_zhualiu")
		};
		for(int i = 0;i < 3;i++){
			for(int k = 0;k < 5;k++){
				m_zhuNames.put(qzhs[i] + qzhkexuan[k],qzhpeilv[k]);
			}
		}
		String[] nius = {"没牛","牛一","牛二","牛三","牛四","牛五","牛六","牛七","牛八","牛九","牛牛"};
		for(int i = 0;i < nius.length;i++){
			if(i == 0)
				m_zhuNames.put(nius[i], m_peiLvConfig.optDouble("nn_no"));
			else
				m_zhuNames.put(nius[i], m_peiLvConfig.optDouble("nn_has"));
		}
	}
	void initOnCurrTime(){
		Date date = new Date();
		int time = date.getHours() * 3600 + date.getMinutes() * 60 + date.getSeconds();
		
		for(int i = 0;i < m_timeConfigs.size();i++){
			CqsscTimeConfig config = m_timeConfigs.get(i);
			if(time > config.m_xiaZhuTime && time <= config.m_kaiJiangTime){
				initOnWithConfig(config,time);
				return;
			}
		}
		initOnWithConfig(null,0);
	}
	void initOnWithConfig(CqsscTimeConfig config,int time){
		if(config == null){
			if(m_currCqssc != null){
				m_prevCqssc = m_currCqssc;
			}
			m_currCqssc = null;
			//处理停盘
			onDealTingPan();
			return;
		}
		Date date = new Date();
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
        String danhaotime = dateFormat.format(date);
        if(m_currCqssc != null){
    		m_prevCqssc = m_currCqssc;
    		//下发全部的客户端
			SUMBCMD_S_PrevResult cmd = new SUMBCMD_S_PrevResult();
			cmd.m_qiHao = m_prevCqssc.m_danHao;
			memcpy(cmd.m_result,m_prevCqssc.m_kaiResult,5);
			cmd.m_sum = m_prevCqssc.m_sum;
			cmd.m_daXiao = m_prevCqssc.m_daXiao;
			cmd.m_danShuang = m_prevCqssc.m_danShuang;
			cmd.m_longHuHe = m_prevCqssc.m_longHuHe;
			cmd.m_nn = m_prevCqssc.m_nn;
			String data = cmd.getJsonData();
			for(int value : m_allChairs.values()){
				SendData(value,data);
			}
        }
		m_currCqssc = new CqsscBenQiInfo();
		m_currCqssc.m_danHao = danhaotime + config.m_index;
		m_currCqssc.m_config = config;
		m_currCqssc.m_requestCount = 0;
		if(time >= config.m_xiaZhuTime && time <= config.m_fengPanTime){
			m_currCqssc.m_curStage = "stage_xiazhu";
		}else if(time > config.m_fengPanTime && time <= config.m_kaiJiangTime){
			m_currCqssc.m_curStage = "stage_fengpan";
		}else{
			m_currCqssc.m_curStage = "stage_kaijiang";
		}
		//广播新的
		SUBCMD_S_CurrStage cmd = new SUBCMD_S_CurrStage();
		cmd.m_curStage = m_currCqssc.m_curStage;
		cmd.m_qiHao = m_currCqssc.m_danHao;
		if(m_currCqssc.m_curStage.equals("stage_xiazhu")){
			cmd.m_fengPanCountDown = m_currCqssc.m_config.m_fengPanTime - time;
			cmd.m_kaiJiangCountDown = m_currCqssc.m_config.m_kaiJiangTime - time;
		}else if(m_currCqssc.m_curStage.equals("stage_fengpan")){
			cmd.m_fengPanCountDown = 0;
			cmd.m_kaiJiangCountDown = m_currCqssc.m_config.m_kaiJiangTime - time;
		}else if(m_currCqssc.m_curStage.equals("stage_kaijiang")){
			cmd.m_fengPanCountDown = 0;
			cmd.m_kaiJiangCountDown = 0 ;
		}
		String data = cmd.getJsonData();
		for(int value : m_allChairs.values()){
			SendData(value,data);
		}
	}
	//停盘计算
	public void onDealTingPan(){
		m_currCqssc = null;//当前的置为空
		Date date = new Date();
		int time = date.getHours() * 3600 + date.getMinutes() * 60 + date.getSeconds();
		for(int i = 1;i < m_timeConfigs.size();i++){
			CqsscTimeConfig config1 = m_timeConfigs.get(i - 1);
			CqsscTimeConfig config2 = m_timeConfigs.get(i);
			if(time >= config1.m_kaiJiangTime && time <= config2.m_xiaZhuTime){
				//出在两者之间
				m_openWaitTime = config2.m_xiaZhuTime - time;
				return;
			}
			if(i == 1 && time < config1.m_xiaZhuTime){
				m_openWaitTime = config1.m_xiaZhuTime - time;
				return;
			}else if(i == 1 && time >= config1.m_xiaZhuTime && time <= config1.m_fengPanTime){
				//第一天开始下注了
				initOnWithConfig(config1,time);
				return;
			}
		}
		//到这里只有一种可能，系统处于等待第二天开奖
		CqsscTimeConfig config1 = m_timeConfigs.get(0);
		m_openWaitTime = config1.m_xiaZhuTime + 24 * 3600 - time;
		sendCurrStageChange();
		return;
	}
	//每一秒处理下状态
	//每隔2分钟推送下目前系统状态
	int pushSystemStatusCount = 0;
	int m_peiLvRefreshCount = 0;
	public void onDealGameStatus(){
		m_peiLvRefreshCount++;
		if(m_peiLvRefreshCount >= 300){
			m_peiLvRefreshCount = 0;
			//刷新下赔率
			JSONObject peilv = GoldMgr.getInstance().getCqsscPeiLvConfig(); 
			String peilvStr = peilv.toString();
			String currPeiLvStr = m_peiLvConfig.toString();
			if(!peilvStr.equals(currPeiLvStr)){
				//有变化，重新初始化,推送全部
				m_peiLvConfig = peilv;
				m_zhuNames.clear();
				initXiaZhuName();
				SUBCMD_S_PeiLv cmd1 = new SUBCMD_S_PeiLv();
				cmd1.m_config = m_peiLvConfig;
				String data = cmd1.getJsonData();
				for(Integer value : m_allChairs.values()){
					SendData(value,data);
				}
			}
		}
		pushSystemStatusCount++;
		if(pushSystemStatusCount >= 60){
			pushSystemStatusCount = 0;
			//推送
			if(m_currCqssc != null){
				System.out.println("重庆时时彩，当前期号:" + m_currCqssc.m_danHao);
				SUBCMD_S_Sync_DownTime cmd = new SUBCMD_S_Sync_DownTime();
				Date date = new Date();
				int time = date.getHours() * 3600 + date.getMinutes() * 60 + date.getSeconds();
				if(m_currCqssc.m_curStage.equals("stage_xiazhu")){
					cmd.m_fengPanCountDown = m_currCqssc.m_config.m_fengPanTime - time;
					cmd.m_kaiJiangCountDown = m_currCqssc.m_config.m_kaiJiangTime - time;
				}else if(m_currCqssc.m_curStage.equals("stage_fengpan")){
					cmd.m_fengPanCountDown = 0;
					cmd.m_kaiJiangCountDown = m_currCqssc.m_config.m_kaiJiangTime - time;
				}else if(m_currCqssc.m_curStage.equals("stage_kaijiang")){
					cmd.m_fengPanCountDown = 0;
					cmd.m_kaiJiangCountDown = 0 ;
				}
				if(cmd.m_fengPanCountDown != 0 || cmd.m_kaiJiangCountDown != 0){
					String data = cmd.getJsonData();
					for(int value : m_allChairs.values()){
						SendData(value,data);
					}
				}
			}
		}
		if(m_currCqssc == null){
			//系统处于停盘，看看时间到了没有,处理等待时间

			Date date = new Date();
			int time = date.getHours() * 3600 + date.getMinutes() * 60 + date.getSeconds();
			for(int i = 0;i < m_timeConfigs.size();i++){
				CqsscTimeConfig config = m_timeConfigs.get(i);
				if(time > config.m_xiaZhuTime && time <= config.m_kaiJiangTime){
					initOnWithConfig(config,time);
					sendCurrStageChange();
					return;
				}
			}
			//处理停盘
			onDealTingPan();
		}else{
			//是否到了封盘，开奖时间
			Date date = new Date();
			int time = date.getHours() * 3600 + date.getMinutes() * 60 + date.getSeconds();
			if(m_currCqssc.m_curStage.equals("stage_kaijiang")){
				//正在开奖，继续等待请求结果
				onRquestKaiJiang();
			}else  if(m_currCqssc.m_curStage.equals("stage_xiazhu")){
				if(time >= m_currCqssc.m_config.m_fengPanTime){
					//进入封盘
					m_currCqssc.m_curStage = "stage_fengpan";
					sendCurrStageChange();
				}else{
					//继续下注
				}
			}else if(m_currCqssc.m_curStage.equals("stage_fengpan")){
				if(time >= m_currCqssc.m_config.m_kaiJiangTime){
					//进入开奖
					onRquestKaiJiang();
				}else{
					//继续封盘
				}
			}
		}
	}
	public void sendCurrStageChange(){
		//状态发生变化，发送所有的客户端
		SUBCMD_S_ChangeStage cmd = new SUBCMD_S_ChangeStage();
		if(m_currCqssc == null){
			//停盘状态
			cmd.m_curStage = "";
			cmd.m_timeCountDown = m_openWaitTime;
			String data = cmd.getJsonData();
			for(Integer value : m_allChairs.values()){
				SendData(value,data);
			}
		}else{
			cmd.m_curStage = m_currCqssc.m_curStage;
			cmd.m_qiHao = m_currCqssc.m_danHao;
			Date date = new Date();
			int time = date.getHours() * 3600 + date.getMinutes() * 60 + date.getSeconds();
			if(m_currCqssc.m_curStage.equals("stage_xiazhu")){
				cmd.m_fengPanCountDown = m_currCqssc.m_config.m_fengPanTime - time;
				cmd.m_kaiJiangCountDown = m_currCqssc.m_config.m_kaiJiangTime - time;
			}else if(m_currCqssc.m_curStage.equals("stage_fengpan")){
				cmd.m_fengPanCountDown = 0;
				cmd.m_kaiJiangCountDown = m_currCqssc.m_config.m_kaiJiangTime - time;
			}else if(m_currCqssc.m_curStage.equals("stage_kaijiang")){
				cmd.m_fengPanCountDown = 0;
				cmd.m_kaiJiangCountDown = 0 ;
			}
			String data = cmd.getJsonData();
			for(Integer value : m_allChairs.values()){
				SendData(value,data);
			}
		}
	}
	public void onRequestOverTime(){
		//本期作废处理,本地订单全部作废
		for(Integer uid : m_benQiZhuDan.keySet()){
			int seat = FindSeat(uid);//用户可能已经离开，存在才操作
			List<JSONObject> datas = m_benQiZhuDan.get(uid);
			SecShmUser user = dthall.getInstance().getSecurityUserInfo(uid);
			double wons = 0.0;
			String zhongList = "";
			for(int i = 0;i < datas.size();i++){
				JSONObject json = datas.get(i);
				json.put("won", 0.0);
				json.put("status", 2);//作废
				//本金反给用户
				if(seat != Constants.INVALID_CHAIR)
					m_pIUserItem[seat].lUserRmb += json.optDouble("needfund");
				user.getRmb1v1(json.optDouble("needfund"));
				//发给用户输赢结果
				if(seat != Constants.INVALID_CHAIR){
					SUBCMD_S_JieSuan cmd = new SUBCMD_S_JieSuan();
					cmd.success = 0;
					cmd.result = "";
					cmd.wons = wons;
					cmd.myRmb = m_pIUserItem[seat].lUserRmb;
					cmd.qihao = m_currCqssc.m_danHao;
					cmd.zhongList = zhongList;
					cmd.wonlose = m_pIUserItem[seat].m_roundWonLose;
					SendData(seat,cmd.getJsonData());
				}
			}
		}
		//保存订单信息
		saveZhuDanIntoRedis();		
	}
		
	public void onRequestJiesuan(String strnums){
		String[] numarray = strnums.split(",");
		int[] nums = new int[5];
		for(int i = 0;i < 5;i++){
			nums[i] = Integer.parseInt(numarray[i]);
		}
		if(m_currCqssc == null){
			m_currCqssc = new CqsscBenQiInfo();
		}
		//两面
		Map<String,String> zhongjiang = new HashMap<String,String>();
		m_currCqssc.m_kaiResult = nums;
		m_currCqssc.m_sum = nums[0] + nums[1] + nums[2] + nums[3] + nums[4];
		if(m_currCqssc.m_sum >= 23){
			m_currCqssc.m_daXiao = "大";
			zhongjiang.put("总和大", "0");
		}else{
			m_currCqssc.m_daXiao = "小";
			zhongjiang.put("总和小", "0");
		}
		if(m_currCqssc.m_sum % 2 == 0){
			m_currCqssc.m_danShuang = "双";
			zhongjiang.put("总和双", "0");
		}else{
			m_currCqssc.m_danShuang = "单";
			zhongjiang.put("总和单", "0");
		}
		if(nums[0] > nums[4]){
			m_currCqssc.m_longHuHe = "龙";
			zhongjiang.put("龙", "0");
		}else if(nums[0] < nums[4]){
			m_currCqssc.m_longHuHe = "虎";
			zhongjiang.put("虎", "0");
		}else{
			m_currCqssc.m_longHuHe = "和";
			zhongjiang.put("和", "0");
		}
		String[] qiunums = {"一","二","三","四","五"};
		for(int i = 0;i < 5;i++){
			int num = nums[i];
			String zhuName = "第" + qiunums[i] + "球";
			if(num >= 5){
				zhongjiang.put(zhuName + "大", "0");
			}else{
				zhongjiang.put(zhuName + "小", "0");
			}
			if(num % 2 == 0){
				zhongjiang.put(zhuName + "双", "0");
			}else{
				zhongjiang.put(zhuName + "单", "0");
			}
		}
		//1-5
		for(int i = 0;i < 5;i++){
			int num = nums[i];
			String zhuName = "第" + qiunums[i] + "球" + num;
			zhongjiang.put(zhuName, "0");
		}
		//前中后
		String[] qzhs = {"前三 ","中三 ","后三 "};
		String[] qzhkexuan = {"豹子","顺子","对子","半顺","杂六"};
		for(int i = 0;i < 3;i++){
			String zhuName = qzhs[i];
			int[] num3 = new int[3];
			if(i == 0){
				num3[0] = nums[0];
				num3[1] = nums[1];
				num3[2] = nums[2];
			}else if(i == 1){
				num3[0] = nums[1];
				num3[1] = nums[2];
				num3[2] = nums[3];
			}else{
				num3[0] = nums[2];
				num3[1] = nums[3];
				num3[2] = nums[4];
			}
			for(int k = 0; k < num3.length - 1; k++) {
	            int minIndex = k;
	            for(int j = k + 1; j < num3.length; j++) {
	                if(num3[j] < num3[minIndex]) {
	                    minIndex = j;
	                }
	            }
	            if(minIndex != k) {
	                int temp = num3[k];
	                num3[k] = num3[minIndex];
	                num3[minIndex] = temp;
	            }
	        }
			int type = getQZHType(num3[0],num3[1],num3[2]);
			zhuName += qzhkexuan[type];
			zhongjiang.put(zhuName, "0");
		}
		//斗牛
		String[] nius = {"没牛","牛一","牛二","牛三","牛四","牛五","牛六","牛七","牛八","牛九","牛牛"};
		int niutype = getNiu(nums);
		zhongjiang.put(nius[niutype], "0");
		m_currCqssc.m_nn = nius[niutype];

		//根据中奖开始结算
		for(Integer uid : m_benQiZhuDan.keySet()){
			int seat = FindSeat(uid);//用户可能已经离开，存在才操作
			List<JSONObject> datas = m_benQiZhuDan.get(uid);
			SecShmUser user = dthall.getInstance().getSecurityUserInfo(uid);
			double sumwons = 0.0;
			String zhongList = "";
			double needfund = 0;
			for(int i = 0;i < datas.size();i++){
				double wons = 0.0;
				zhongList += "第" + (i + 1) + "注,";
				JSONObject json = datas.get(i);
				String data = json.optString("data");
				needfund += json.optDouble("needfund");
				int difen = json.optInt("difen");
				String[] xiazhus = data.split(",");
				for(int k = 0;k < xiazhus.length;k++){
					if(zhongjiang.containsKey(xiazhus[k])){
						//中了
						double peilv = m_zhuNames.get(xiazhus[k]);
						wons += peilv * difen; 
						zhongList += xiazhus[k] + " 压中,";
					}else{
						//输了
						zhongList += xiazhus[k] + " 不中,";
						if((xiazhus[k].equals("龙") || xiazhus[k].equals("虎")) && zhongjiang.containsKey("和")){
							//开和则龙虎退本金
							zhongList += xiazhus[k] + " 退,"; 
							wons += difen; 
						}
					}
				}
				json.put("won", wons);
				json.put("kaijiang", strnums);
				json.put("status", 1);
				sumwons += wons;
			}
			//开始记录
			if(sumwons > 0.0){
				BigDecimal b = new BigDecimal(sumwons);
				sumwons = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
				if(seat != Constants.INVALID_CHAIR){
					m_pIUserItem[seat].lUserRmb += sumwons;
				}
				user.getRmb1v1(sumwons);
			}
			//扣除押注的
			UserRmbChange.handleRmbChangeWinLose(user,sumwons - needfund,UserRmbChange.reason109);
			//业绩
			//UserRedisInfo.addYeJiFanXian(uid,Math.abs(sumwons - needfund));//彩票类不参与
			//租赁
			UserRedisInfo.addKouWonLoseGameForRent(uid,sumwons - needfund);
			//发给用户输赢结果
			if(seat != Constants.INVALID_CHAIR){
				SUBCMD_S_JieSuan cmd = new SUBCMD_S_JieSuan();
				cmd.success = 1;
				cmd.result = strnums;
				cmd.wons = sumwons;
				cmd.myRmb = m_pIUserItem[seat].lUserRmb;
				cmd.qihao = m_currCqssc.m_danHao;
				cmd.zhongList = zhongList;
				if(seat != Constants.INVALID_CHAIR){
					m_pIUserItem[seat].m_roundWonLose += sumwons - needfund;
					cmd.wonlose = m_pIUserItem[seat].m_roundWonLose;
				}
				SendData(seat,cmd.getJsonData());
			}
			//记录战绩
			JSONObject recordjson = new JSONObject();
			recordjson.put("gameName", "重庆时时彩");
			recordjson.put("roomId",m_currCqssc.m_danHao + "期");
			recordjson.put("time", UserRedisInfo.getRecordTimeKey());
			if(seat != Constants.INVALID_CHAIR){
				recordjson.put("name0", m_pIUserItem[seat].szNickName);
			}else{
				recordjson.put("name0", "用户");
			}
			recordjson.put("score0",sumwons - needfund);
			recordjson.put("uid0",uid);
			DwcRedisRecord.getInstance().addZhanJi(recordjson);
		}
		//保存订单信息
		saveZhuDanIntoRedis();
	}
	public int getNiu(int[] orignums){
		int[] nums = new int[5];
		Constants.memcpy(nums, orignums, 5);
	    int[] selectList = new int[3];
	    boolean found = false;
		for (int i = 0; i < nums.length; i++) {
			for (int n = i + 1; n < nums.length; n++) {
				for (int m = n + 1; m < nums.length; m++) {
					int idx1 = nums[i];
					int idx2 = nums[n];
					int idx3 = nums[m];
					int num = idx1 + idx2 + idx3;
					if (num % 10 == 0) {
						selectList[0] = nums[i];
						selectList[1] = nums[n];
						selectList[2] = nums[m];
						found = true;
						break;
					}
				}
				if(found){
					break;
				}
			}
			if(found){
				break;
			}
		}
		if(!found){
			//没有牛
			return 0;
		}
		int left = 0;
		for(int i = 0;i < 5;i++){
			for(int k = 0;k < 3;k++){
				if(nums[i] == selectList[k]){
					selectList[k] = -1;
					nums[i] = 0;
					break;
				}
			}
		}
		for(int i = 0;i < 5;i++){
			left += nums[i];
		}
		left %= 10;
		if(left == 0){
			return 10;
		}else{
			return left;
		}
	}
	public int getQZHType(int a1,int a2,int a3){
		//豹子,返回qzhkexuan的index
		if(a1 == a2 && a2 == a3)
			return 0;
		//顺子
		if((a1 + 1) == a2 && (a2 + 1) == a3)
			return 1;
		//循环顺
		if(a1 == 0 && a2 == 1 && a3 == 9)
			return 1;
		//对子
		if(a1 == a2 || a2 == a3){
			return 2;
		}
		//半顺
		if((a1 + 1) == a2 || (a2 +1) == a3){
			return 3;
		}
		//所有的都不是则是杂六
		return 4;
	}
	public void Handle_KaiJiangMoNi(int _Uid, String vecArg[]){
		int wChairID = FindSeat(_Uid);
		if (wChairID == Constants.INVALID_CHAIR) {
			return;
		}
		onRequestResult("1,2,3,4,5");
	}
	public void onRequestResult(String result){
		//开始结算
		onRequestJiesuan(result);
		//处理订单
		//进入下一个周期
		Date date = new Date();
		int time = date.getHours() * 3600 + date.getMinutes() * 60 + date.getSeconds();
		for(int i = 0;i < m_timeConfigs.size();i++){
			CqsscTimeConfig config = m_timeConfigs.get(i);
			if(time > config.m_xiaZhuTime && time <= config.m_kaiJiangTime){
				initOnWithConfig(config,time);
				return;
			}
		}
		//切换状态
        if(m_currCqssc != null){
    		m_prevCqssc = m_currCqssc;
    		//下发全部的客户端
			SUMBCMD_S_PrevResult cmd = new SUMBCMD_S_PrevResult();
			cmd.m_qiHao = m_prevCqssc.m_danHao;
			memcpy(cmd.m_result,m_prevCqssc.m_kaiResult,5);
			cmd.m_sum = m_prevCqssc.m_sum;
			cmd.m_daXiao = m_prevCqssc.m_daXiao;
			cmd.m_danShuang = m_prevCqssc.m_danShuang;
			cmd.m_longHuHe = m_prevCqssc.m_longHuHe;
			cmd.m_nn = m_prevCqssc.m_nn;
			String data = cmd.getJsonData();
			for(int value : m_allChairs.values()){
				SendData(value,data);
			}
        }
		//处理停盘
		onDealTingPan();
	}
	public void onRquestKaiJiang(){
		//请求结果，完成后变成stage_finish状态
		int currTime = (int) (System.currentTimeMillis() / 1000);
		//5s请求一次，不到5s不处理，避免被屏蔽
		if(currTime - m_currCqssc.m_nextRequestTime < 5){
			return;
		}
		m_currCqssc.m_requestCount++;
		m_currCqssc.m_nextRequestTime = currTime;
		String rev = "";
		try{
			CHttpClient http = new CHttpClient();
			rev = http.requestHttpInfo(m_requestUrl);
		}catch(Exception e){
			//请求不到最新的
			if(m_currCqssc.m_requestCount >= 120){//最多等待10分钟,过期作废
				//本期作废  处理订单
				onRequestOverTime();
				//进入下一个周期
				Date date = new Date();
				int time = date.getHours() * 3600 + date.getMinutes() * 60 + date.getSeconds();
				for(int i = 0;i < m_timeConfigs.size();i++){
					CqsscTimeConfig config = m_timeConfigs.get(i);
					if(time > config.m_xiaZhuTime && time <= config.m_kaiJiangTime){
						initOnWithConfig(config,time);
						return;
					}
				}
				//处理停盘
				onDealTingPan();
			}
			return;
		}
		if(rev == null){
			if(m_currCqssc.m_requestCount >= 120){//最多等待10分钟,过期作废
				//本期作废  处理订单
				onRequestOverTime();
				//进入下一个周期
				Date date = new Date();
				int time = date.getHours() * 3600 + date.getMinutes() * 60 + date.getSeconds();
				for(int i = 0;i < m_timeConfigs.size();i++){
					CqsscTimeConfig config = m_timeConfigs.get(i);
					if(time > config.m_xiaZhuTime && time <= config.m_kaiJiangTime){
						initOnWithConfig(config,time);
						return;
					}
				}
				//处理停盘
				onDealTingPan();
			}
		}else{
			try{
				JSONObject obj = JSONObject.fromObject(rev);
				JSONArray arrayData = obj.optJSONArray("retData");
				if(arrayData.size() != 0){
					for(int i = 0;i < arrayData.size();i++){
						JSONObject first = arrayData.getJSONObject(i);
						String danhao = first.optString("WinningNumber");
						if(m_currCqssc.m_danHao.equals(danhao)){
							onRequestResult(first.optString("WinningNumbers"));
							return;
						}
					}
				}
				//请求不到最新的
				if(m_currCqssc.m_requestCount >= 120){//最多等待10分钟,过期作废
					//本期作废  处理订单
					onRequestOverTime();
					//进入下一个周期
					Date date = new Date();
					int time = date.getHours() * 3600 + date.getMinutes() * 60 + date.getSeconds();
					for(int i = 0;i < m_timeConfigs.size();i++){
						CqsscTimeConfig config = m_timeConfigs.get(i);
						if(time > config.m_xiaZhuTime && time <= config.m_kaiJiangTime){
							initOnWithConfig(config,time);
							return;
						}
					}
					//处理停盘
					onDealTingPan();
				}
				return;
			}catch(Exception e){
				//数据错误  本期作废
				if(m_currCqssc.m_requestCount < 120){
					return;
				}
				onRequestOverTime();
				//进入下一个周期
				Date date = new Date();
				int time = date.getHours() * 3600 + date.getMinutes() * 60 + date.getSeconds();
				for(int i = 0;i < m_timeConfigs.size();i++){
					CqsscTimeConfig config = m_timeConfigs.get(i);
					if(time > config.m_xiaZhuTime && time <= config.m_kaiJiangTime){
						initOnWithConfig(config,time);
						return;
					}
				}
				//处理停盘
				onDealTingPan();
			}
		}
	}
	void KickRobots() {

	}

	boolean HasRobot() {
		return false;
	}

	void SendAvatar(int _Uid) {
		int wChairID = FindSeat(_Uid);
		if (wChairID == Constants.INVALID_CHAIR) {
			return;
		}

		String iter = dthall.getInstance().Handle_OnGetUserAvatar(_Uid);

		SUBCMD_S_Avatar cmd = new SUBCMD_S_Avatar();
		cmd.m_lUid = _Uid;
		if (iter != null) {
			cmd.szAvatarURL = iter;
		} else {
			cmd.szAvatarURL = PublishDef.getDefaultHeadAvatar();
		}

		SendData(Constants.INVALID_CHAIR, cmd.getJsonData());

	}

	public void SendLocationData(SHMUser user) {
		JSONObject data = new JSONObject();
		data.put("loc", user.getGpsLocInfo());
		data.put("uid", user.getUid());
		data.put("command", "GPS_LOC");
		SendData(Constants.INVALID_CHAIR, data.toString());

		for (short i = 0; i < m_pIUserItem.length; i++) {
			if (m_pIUserItem[i].dwUserID > 0) {
				if (m_pIUserItem[i].isAndroidUser == 0) {
					int uid = m_pIUserItem[i].dwUserID;
					SHMUser other = dthall.getInstance().getUserInfo(uid);
					if (other != null) {
						data.put("uid", other.getUid());
						data.put("loc", other.getGpsLocInfo());
						dthall.getInstance().onSend(user.getUid(), data.toString());
					}
				}
			}
		}
	}

	public void SendGpsData(SHMUser user) {
		JSONObject data = new JSONObject();
		List<Double> gpsData = user.getLocateInfo();
		data.put("lng", gpsData.get(0));
		data.put("lat", gpsData.get(1));
		data.put("command", "GPS_DATA");
		data.put("uid", user.getUid());
		SendData(Constants.INVALID_CHAIR, data.toString());

		for (short i = 0; i < m_pIUserItem.length; i++) {
			if (m_pIUserItem[i].dwUserID > 0) {
				if (m_pIUserItem[i].isAndroidUser == 0) {
					int uid = m_pIUserItem[i].dwUserID;
					SHMUser other = dthall.getInstance().getUserInfo(uid);
					if (other != null) {
						gpsData = other.getLocateInfo();
						data.put("uid", other.getUid());
						data.put("lng", gpsData.get(0));
						data.put("lat", gpsData.get(1));
						dthall.getInstance().onSend(user.getUid(), data.toString());
					}
				}
			}
		}
	}

	public void OnUserSit(int _Uid) {
		int bySeatID = FindSeat(_Uid);
		if (bySeatID < m_maxUserNum) {
			m_pIUserItem[bySeatID].cbOnline = Constants.US_NULL;
		}
		SHMUser user = dthall.getInstance().getUserInfo(_Uid);
		if (user != null) {
			if(m_allChairs.containsKey(_Uid)){
				int i = m_allChairs.get(_Uid);
				m_pIUserItem[i].dwUserID = _Uid;
				// m_pIUserItem[i].lUserScore = user.getCoin();
				m_pIUserItem[i].wChairID = i;
				m_pIUserItem[i].dwFaceID = 0;
				m_pIUserItem[i].cbGender = user.getSex();
				m_pIUserItem[i].szNickName = user.getNickName(null);
				m_pIUserItem[i].szIP = user.getIP(null);
				m_pIUserItem[i].lUserCoin = user.getCoin(0);
				if (this.isDwcType()) {
					m_pIUserItem[i].lUserRmb = user.getRmb1v1Value();
				}

				if (user.isAndroidPlayer()) {
					m_pIUserItem[i].isAndroidUser = 2;
				}
				SUBCMD_S_Sit cmd = new SUBCMD_S_Sit();

				cmd.m_lUid = _Uid;
				cmd.m_wUserChairID = m_pIUserItem[i].wChairID;
				cmd.m_dwTableID = m_dwTableID;
				cmd.m_lUserScore = m_pIUserItem[i].lUserScore;
				cmd.m_cbGender = m_pIUserItem[i].cbGender;
				cmd.m_iAvatar = m_pIUserItem[i].dwFaceID;
				cmd.szNickName = user.getNickName(null);
				cmd.szIP = user.getIP(null);
				cmd.m_byRound = m_UserStatus;
				if (this.isGoldType())
					cmd.m_lUserCoin = user.getCoin(0);
				else if (this.isDwcType())
					cmd.m_lUserCoin = user.getRmb1v1Value();

				SendData(i, cmd.getJsonData());

				if (m_bGameStarted) {
					SendGameScene(_Uid, Constants.GS_PLAYING);
				} else {
					SendGameScene(_Uid, Constants.GS_FREE);
				}

				SendAvatar(m_pIUserItem[i].dwUserID);

				return;
			}
			for (int i = 0; i < m_maxUserNum; i++) {
				if (m_pIUserItem[i].dwUserID == 0) {
					addChairUser(_Uid,i);
					m_pIUserItem[i].dwUserID = _Uid;
					m_pIUserItem[i].lUserScore = 0;
					m_pIUserItem[i].wChairID = i;
					m_pIUserItem[i].dwFaceID = 0;
					m_pIUserItem[i].cbGender = user.getSex();
					m_pIUserItem[i].szNickName = user.getNickName(null);
					m_pIUserItem[i].szIP = user.getIP(null);
					m_pIUserItem[i].lUserCoin = user.getCoin(0);
					if (this.isDwcType()) {
						m_pIUserItem[i].lUserRmb = user.getRmb1v1Value();
					}

					if (user.isAndroidPlayer()) {
						m_pIUserItem[i].isAndroidUser = 2;
					}
					SUBCMD_S_Sit cmd = new SUBCMD_S_Sit();

					cmd.m_lUid = _Uid;
					cmd.m_wUserChairID = m_pIUserItem[i].wChairID;
					cmd.m_dwTableID = m_dwTableID;
					cmd.m_lUserScore = m_pIUserItem[i].lUserScore;
					cmd.m_cbGender = m_pIUserItem[i].cbGender;
					cmd.m_iAvatar = m_pIUserItem[i].dwFaceID;
					cmd.szNickName = user.getNickName(null);
					cmd.szIP = user.getIP(null);
					cmd.m_byRound = m_UserStatus;
					if (this.isGoldType())
						cmd.m_lUserCoin = user.getCoin(0);
					else if (this.isDwcType())
						cmd.m_lUserCoin = user.getRmb1v1Value();

					SendData(i, cmd.getJsonData());

					if (m_bGameStarted) {
						SendGameScene(_Uid, Constants.GS_PLAYING);
					} else {
						SendGameScene(_Uid, Constants.GS_FREE);
					}

					return;
				}
			}
		}

		return;
	}

	int FindSeat(long _Uid) {
		for (int bySeatID = 0; bySeatID < m_maxUserNum; bySeatID++) {
			if (m_pIUserItem[bySeatID].dwUserID == _Uid) {
				return bySeatID;
			}
		}
		return Constants.INVALID_CHAIR;
	}

	int GetPlayerCount() {
		int cntPlayer = 0;
		for (int i = 0; i < m_maxUserNum; i++) {
			if (m_pIUserItem[i].dwUserID > 0) {
				cntPlayer++;
			}
		}
		return cntPlayer;
	}

	int GetRobotCount() {
		int cntPlayer = 0;
		for (int i = 0; i < m_maxUserNum; i++) {
			if (m_pIUserItem[i].isAndroidUser == 1) {
				cntPlayer++;
			}
		}
		return cntPlayer;
	}

	public void OnUserStandUp(int _Uid, boolean leaveroom) {
		int wChairID = FindSeat(_Uid);

		if (m_bTableStarted == false && wChairID != 0 && leaveroom == true) {
			SUBCMD_S_StandUp cmd = new SUBCMD_S_StandUp();
			cmd.m_lUid = _Uid;
			cmd.m_wUserChairID = wChairID;
			cmd.m_dwTableID = m_dwTableID;
			SendData(Constants.INVALID_CHAIR, cmd.getJsonData());
		}

		if (m_bTableStarted == false && leaveroom == true) {
			if (wChairID >= 0 && wChairID < m_maxUserNum) {
				removeChairUser(_Uid);
				m_pIUserItem[wChairID].Init();
				QpGameMgr.getInstance().OnRemoveUserRoom(_Uid);
			} else {
			}
		} else {
			if (wChairID < m_maxUserNum) {
				m_pIUserItem[wChairID].cbOnline = Constants.US_OFFLINE;
			}
		}
	}

	public void SetParam(String szParam) {
		m_strParam = szParam;

		m_vecParam = m_strParam.split(";");
	}

	public void SetDesc(String szDesc) {
		m_strRoomDesc = szDesc;

	}

	boolean SendGameScene(int _Uid, int bGameStatus) {
		int wChairID = FindSeat(_Uid);
		if (wChairID >= m_maxUserNum) {
			return false;
		}
		if (m_strParam.length() > 0) {

			SUBCMD_S_Param cmd = new SUBCMD_S_Param();
			cmd.m_dwTableID = m_dwTableID;
			cmd.szParam = m_strParam;
			SendData(_Uid, cmd.getJsonData());
		}

		int cntUser = 0;
		for (int i = 0; i < m_maxUserNum; i++) {
			if (m_pIUserItem[i].dwUserID > 0) {
				cntUser++;
			}
		}
		{
			SUBCMD_S_Table cmd = new SUBCMD_S_Table();
			cmd.m_dwTableID = m_dwTableID;// ����ID
			cmd.m_bGameStarted = m_bGameStarted ? 1 : 0;// �Ƿ�ʼ
			cmd.m_bTableStarted = m_bTableStarted ? 1 : 0;// �Ƿ�ʼ
			cmd.m_byRound = m_byRound;
			cmd.m_byMaxRound = m_byMaxRound;
			cmd.m_cntUser = cntUser;// ���
			cmd.m_cntLookon = 1;// ����
			Constants.memset(cmd.m_seatInfo, 0, Constants.sizeof(cmd.m_seatInfo));

			cmd.m_seatInfo[0].m_lUid = m_pIUserItem[wChairID].dwUserID;// UID
			cmd.m_seatInfo[0].m_iTotalCoin = m_pIUserItem[wChairID].lUserScore;// COIN
			cmd.m_seatInfo[0].m_NickName = m_pIUserItem[wChairID].szNickName;// NICKNAME
			cmd.m_seatInfo[0].m_iBetCoin = 0;//
			cmd.m_seatInfo[0].m_cbGender = m_pIUserItem[wChairID].cbGender;
			cmd.m_seatInfo[0].m_iAvatar = m_pIUserItem[wChairID].dwFaceID;//
			cmd.m_seatInfo[0].m_cbUserStatus = m_pIUserItem[wChairID].cbUserStatus;// �û�״̬
			cmd.m_seatInfo[0].m_iVipLevel = m_pIUserItem[wChairID].cbVipLevel;// VIP
			// LEVEL
			cmd.m_seatInfo[0].m_iTitle = 0;// �ƺ�
			cmd.m_seatInfo[0].m_isLookon = 0;// �Ƿ����
			cmd.m_seatInfo[0].szIP = m_pIUserItem[wChairID].szIP;// NICKNAME
			if (this.isGoldType())
				cmd.m_seatInfo[0].m_iTotalCoin = m_pIUserItem[wChairID].lUserCoin;
			else if (this.isDwcType())
				cmd.m_seatInfo[0].m_iTotalCoin = m_pIUserItem[wChairID].lUserRmb;

			SendData(_Uid, cmd.getJsonData());
		}
		//send配置文件
		SUBCMD_S_PeiLv cmd1 = new SUBCMD_S_PeiLv();
		cmd1.m_config = m_peiLvConfig;
		String data = cmd1.getJsonData();
		SendData(wChairID,data);
		//send上期状态
		if(m_prevCqssc != null){
			SUMBCMD_S_PrevResult cmd = new SUMBCMD_S_PrevResult();
			cmd.m_qiHao = m_prevCqssc.m_danHao;
			memcpy(cmd.m_result,m_prevCqssc.m_kaiResult,5);
			cmd.m_sum = m_prevCqssc.m_sum;
			cmd.m_daXiao = m_prevCqssc.m_daXiao;
			cmd.m_danShuang = m_prevCqssc.m_danShuang;
			cmd.m_longHuHe = m_prevCqssc.m_longHuHe;
			cmd.m_nn = m_prevCqssc.m_nn;
			data = cmd.getJsonData();
			SendData(wChairID,data);
		}else{
			SUMBCMD_S_PrevResult cmd = new SUMBCMD_S_PrevResult();
			cmd.m_qiHao = "";
			data = cmd.getJsonData();
			SendData(wChairID,data);
		}
		//send当前状态
		if(m_currCqssc == null){
			//停盘状态
			SUBCMD_S_CurrStage cmd = new SUBCMD_S_CurrStage();
			cmd.m_curStage = "";
			cmd.m_timeCountDown = m_openWaitTime;
			data = cmd.getJsonData();
			SendData(wChairID,data);
		}else{
			//各种状态处理
			SUBCMD_S_CurrStage cmd = new SUBCMD_S_CurrStage();
			cmd.m_curStage = m_currCqssc.m_curStage;
			cmd.m_qiHao = m_currCqssc.m_danHao;
			Date date = new Date();
			int time = date.getHours() * 3600 + date.getMinutes() * 60 + date.getSeconds();
			if(m_currCqssc.m_curStage.equals("stage_xiazhu")){
				cmd.m_fengPanCountDown = m_currCqssc.m_config.m_fengPanTime - time;
				cmd.m_kaiJiangCountDown = m_currCqssc.m_config.m_kaiJiangTime - time;
			}else if(m_currCqssc.m_curStage.equals("stage_fengpan")){
				cmd.m_fengPanCountDown = 0;
				cmd.m_kaiJiangCountDown = m_currCqssc.m_config.m_kaiJiangTime - time;
			}else if(m_currCqssc.m_curStage.equals("stage_kaijiang")){
				cmd.m_fengPanCountDown = 0;
				cmd.m_kaiJiangCountDown = 0 ;
			}
			data = cmd.getJsonData();
			SendData(wChairID,data);
		}

		return true;
	}

	void OnEventGameStart() {
		Init(Constants.INIT_NEWROUND);
		if (m_byRound == 0)
			m_byRound = 1;
		OnRoundInfoChange();
		for (int i = 0; i < m_maxUserNum; i++) {
			if (m_pIUserItem[i].dwUserID > 0) {
				m_pIUserItem[i].cbUserStatus = Constants.US_PLAY;
			}
		}
		m_bTableStarted = true;
		m_bGameStarted = true;
	}

	public void DoDismissRoomByOverTime() {
		OnEventGameEnd(0, Constants.GAME_END_DISMISS);
	}

	void OnEventGameEnd(int bySeatID, int cbReason) {
		if (isZuJuType()) {
			OnEventGameEndZuJu(bySeatID, cbReason);
		} else if (isGoldType()) {
			onEventGameEndGold(bySeatID, cbReason);
		} else if (isDwcType()) {
			onEventGameEndDwc(bySeatID, cbReason);
		}
	}

	void onEventGameEndDwc(int bySeatID, int cbReason) {

	}

	void onEventGameEndGold(int bySeatID, int cbReason) {

	}

	void OnEventGameEndZuJu(int bySeatID, int cbReason) {

	}

	static int log_counter = 0;

	int GetNextUser(int bySeatID) {
		int wNextUser = 0;
		for (int i = 1; i <= m_maxUserNum; i++) {
			wNextUser = (bySeatID + i) % m_maxUserNum;
			if (m_pIUserItem[wNextUser].dwUserID > 0) {
				return wNextUser;
			}

		}
		return 0;
	}

	public long currDealTime = 0;

	void OnDealAI(float dt) {

	}

	public long currDealTime1 = 0;

	public void OnDeal(int dt) {
		if (currDealTime1 == 0) {
			currDealTime1 = System.currentTimeMillis();
		} else {
			long time = System.currentTimeMillis();
			if ((time - currDealTime1) >= 1000) {
				currDealTime1 = time;
			} else {
				return;
			}
			onDealGameStatus();
		}
	}

	public void DoAddRobotPlayer() {
	}

	static int randRobotIndex = 999;

	void AddRobot() {

	}

	void Handle_onJoin(int _Uid, String vecArg[]) {
		int bySeatID = FindSeat(_Uid);
		if (bySeatID < m_maxUserNum) {
			m_pIUserItem[bySeatID].cbOnline = Constants.US_NULL;
		}

		SUBCMD_S_Join cmd = new SUBCMD_S_Join();

		String sData = cmd.getJsonData();
		SendData(_Uid, sData);
	}

	void Handle_onReady(int _Uid, String vecArg[]) {
		if (m_bGameStarted == true) {
			return;
		}
		int bySeatID = FindSeat(_Uid);
		if (bySeatID < m_maxUserNum) {
			m_pIUserItem[bySeatID].cbUserStatus = Constants.US_READY;
			m_UserStatus[bySeatID] = Constants.US_READY;
		}
		int roomUserNumber = 0;
		UserCntReady = 0;
		for (int i = 0; i < m_maxUserNum; i++) {
			if (m_pIUserItem[i].cbUserStatus == Constants.US_READY) {
				UserCntReady++;
			}
			if (m_pIUserItem[i].wChairID >= 0) {
				roomUserNumber++;
			}
		}

		SUBCMD_S_Ready cmd = new SUBCMD_S_Ready();
		cmd.m_lUid = _Uid;
		cmd.m_wUserChairID = bySeatID;
		cmd.m_dwTableID = m_dwTableID;
		cmd.m_byRound = m_UserStatus;
		SendData(Constants.INVALID_CHAIR, cmd.getJsonData());

		if (UserCntReady == roomUserNumber) {
			OnEventGameStart();
		}
	}

	void Handle_onRobot(int _Uid, String vecArg[]) {
		if (m_bGameStarted == true) {
			return;
		}
		int bySeatID = FindSeat(_Uid);
		if (bySeatID < m_maxUserNum) {
			m_pIUserItem[bySeatID].cbUserStatus = Constants.US_READY;
		}
		int cntPlayer = 0;
		for (int i = 0; i < m_maxUserNum; i++) {
			if (m_pIUserItem[i].dwUserID > 0) {
				cntPlayer++;
			}
		}
		if (cntPlayer < m_maxUserNum) {
			for (int i = 0; i < m_maxUserNum - cntPlayer; i++) {
				AddRobot();
			}
		}
	}

	void Handle_onBiaoQing(int _Uid, String vecArg[]) {
		int wChairID = FindSeat(_Uid);
		if (wChairID == Constants.INVALID_CHAIR) {
			return;
		}
		if (vecArg.length < 2)
			return;
		int index = Constants.atoi(vecArg[1]);

		SUBCMD_S_BiaoQing cmd = new SUBCMD_S_BiaoQing();
		cmd.m_lUid = _Uid;
		cmd.m_wUserChairID = wChairID;
		cmd.m_iBiaoQingIndex = index;

		SendData(Constants.INVALID_CHAIR, cmd.getJsonData());
	}

	void Handle_onYuYin(int _Uid, String vecArg[]) {
		int wChairID = FindSeat(_Uid);
		if (wChairID == Constants.INVALID_CHAIR) {
			return;
		}
		if (vecArg.length < 2)
			return;
		int index = Constants.atoi(vecArg[1]);

		SUBCMD_S_YuYin cmd = new SUBCMD_S_YuYin();
		cmd.m_lUid = _Uid;
		cmd.m_wUserChairID = wChairID;
		cmd.m_iYuYinIndex = index;

		SendData(Constants.INVALID_CHAIR, cmd.getJsonData());
	}

	void Handle_onSongLi(int _Uid, String vecArg[]) {
	}

	void Handle_onChat(int _Uid, String vecArg[]) {
		int wChairID = FindSeat(_Uid);
		if (wChairID == Constants.INVALID_CHAIR) {
			return;
		}
		if (vecArg.length < 2)
			return;
		String strContent = vecArg[1];

		SUBCMD_S_Chat cmd = new SUBCMD_S_Chat();
		cmd.m_lUid = _Uid;
		cmd.m_wUserChairID = wChairID;
		cmd.szContent = strContent;
		cmd.name = m_pIUserItem[wChairID].szNickName;
		SendData(Constants.INVALID_CHAIR, cmd.getJsonData());
	}

	void Handle_onVoice(int _Uid, String vecArg[]) {
		int wChairID = FindSeat(_Uid);
		if (wChairID == Constants.INVALID_CHAIR) {
			return;
		}
		if (vecArg.length < 3)
			return;
		int seconds = Constants.atoi(vecArg[1]);
		String strVoiceURL = vecArg[2];

		SUBCMD_S_Voice cmd = new SUBCMD_S_Voice();
		cmd.m_lUid = _Uid;
		cmd.m_wUserChairID = wChairID;
		cmd.seconds = seconds;
		cmd.szVoiceURL = strVoiceURL;

		SendData(Constants.INVALID_CHAIR, cmd.getJsonData());
	}

	void Handle_onExpr(int _Uid, String[] vecArg) {
		int wChairID = FindSeat(_Uid);
		if (wChairID == Constants.INVALID_CHAIR) {
			return;
		}
		int uid1 = Integer.parseInt(vecArg[1]);
		int uid2 = Integer.parseInt(vecArg[2]);
		int index = Integer.parseInt(vecArg[3]);

		SUBCMD_S_ExprMsg cmd = new SUBCMD_S_ExprMsg();
		cmd.m_uid1 = uid1;
		cmd.m_uid2 = uid2;
		cmd.m_index = index;

		SendData(Constants.INVALID_CHAIR, cmd.getJsonData());
	}

	void Handle_onVoiceMsg(int _Uid, String[] vecArg) {
		int wChairID = FindSeat(_Uid);
		if (wChairID == Constants.INVALID_CHAIR) {
			return;
		}
		float seconds = Float.parseFloat(vecArg[1]);

		SUBCMD_S_VoiceMsg cmd = new SUBCMD_S_VoiceMsg();
		cmd.m_lUid = _Uid;
		cmd.m_wUserChairID = wChairID;
		cmd.seconds = seconds;

		cmd.data = vecArg[2];
		cmd.m_maxClip = Integer.parseInt(vecArg[3]);
		cmd.m_currClip = Integer.parseInt(vecArg[4]);
		SendData(Constants.INVALID_CHAIR, cmd.getJsonData());
	}

	void Handle_onTryDismissRoom(int _Uid, String vecArg[]) {
		int bySeatID = FindSeat(_Uid);
		if (bySeatID == Constants.INVALID_CHAIR) {
			return;
		}
		if (vecArg.length < 2)
			return;
		String attachInfo = vecArg[1];
		if (attachInfo.equals("fzquit")) {
			// 房主请求直接退出
			OnEventGameEnd(0, Constants.GAME_END_DISMISS);
			return;
		}
		int cntUser = 0;
		int cntOnline = 0;
		int cntOffline = 0;
		for (int i = 0; i < m_maxUserNum; i++) {
			if (m_pIUserItem[i].dwUserID > 0 && m_pIUserItem[i].isAndroidUser == 0 && m_pIUserItem[i].cbOnline == 0) {
				cntUser++;
			}
		}
		for (int i = 0; i < m_maxUserNum; i++) {
			if (m_pIUserItem[i].dwUserID > 0 && m_pIUserItem[i].isAndroidUser == 0) {
				if (m_pIUserItem[i].cbOnline == Constants.US_OFFLINE) {
					cntOffline++;
				} else {
					cntOnline++;
				}
			}
		}
		if (cntUser > 1) {
			if (m_dismissTimer == 0) {
				m_dismissTimer = Constants.time(null);
			}

			SUBCMD_S_TryDismissRoom cmd = new SUBCMD_S_TryDismissRoom();
			cmd.lUid = _Uid;
			cmd.dwTableID = m_dwTableID;
			cmd.szNickName = m_pIUserItem[bySeatID].szNickName;

			SendData(Constants.INVALID_CHAIR, cmd.getJsonData());

			if (cntOnline == 1) {
				OnEventGameEnd(0, Constants.GAME_END_DISMISS);

				m_dismissTimer = 0;
			}
		} else {
			OnEventGameEnd(0, Constants.GAME_END_DISMISS);
		}

	}

	void Handle_onAgreeDismissRoom(int _Uid, String vecArg[]) {

	}

	void Handle_onRefuseDismissRoom(int _Uid, String vecArg[]) {

	}

	void Handle_onStart(int _Uid, String vecArg[]) {
		if (vecArg.length < 2)
			return;

		int bySeatID = FindSeat(_Uid);
		if (m_bTableStarted == false && bySeatID == 0 && GetPlayerCount() > 1) {
			OnEventGameStart();
		}
	}

	void Handle_onUserList(int _Uid, String vecArg[]) {
		if (vecArg.length < 2)
			return;
		int bySeatID = FindSeat(_Uid);
		if (bySeatID == Constants.INVALID_CHAIR) {
			return;
		}
		JSONObject rev = new JSONObject();
		rev.put("command", "dwc_user_list");
		List<String> infos = new ArrayList<String>();
		for (int i = 0; i < this.m_maxUserNum; i++) {
			if (m_pIUserItem[i].dwUserID > 0) {
				JSONObject json = new JSONObject();
				json.put("name", m_pIUserItem[i].szNickName);
				json.put("headUrl", dthall.getInstance().Handle_OnGetUserAvatar(m_pIUserItem[i].dwUserID));
				json.put("rmb", m_pIUserItem[i].lUserRmb);
				infos.add(json.toString());
			}
		}
		rev.put("data", infos);
		SendData(bySeatID, rev.toString());
	}


	void Handle_onXiaZhu(int _Uid, String vecArg[]) {
		if (vecArg.length < 4)
			return;
		int bySeatID = FindSeat(_Uid);
		if (bySeatID == Constants.INVALID_CHAIR) {
			return;
		}

		boolean running = GoldMgr.getInstance().getCPRunning();
		if(running == false){
			SUBCMD_S_XiaZhuRev cmd = new SUBCMD_S_XiaZhuRev();
			cmd.lUid = _Uid;
			cmd.success = 0;
			cmd.reason = "系统维护中,无法下注,请发信息进行咨询...";
			SendData(bySeatID, cmd.getJsonData());
			return;
		}
		int num = Integer.parseInt(vecArg[1]);
		double needfund = Double.parseDouble(vecArg[2]);
		String data = vecArg[3];
		if(m_currCqssc == null || !m_currCqssc.m_curStage.equals("stage_xiazhu")){
			//无法下注
			SUBCMD_S_XiaZhuRev cmd = new SUBCMD_S_XiaZhuRev();
			cmd.lUid = _Uid;
			cmd.success = 0;
			cmd.reason = "系统封盘中，无法下注...";
			SendData(bySeatID, cmd.getJsonData());
			return;
		}
		//检查资金
		if(m_pIUserItem[bySeatID].lUserRmb < needfund){
			SUBCMD_S_XiaZhuRev cmd = new SUBCMD_S_XiaZhuRev();
			cmd.lUid = _Uid;
			cmd.success = 0;
			cmd.reason = "资金不足，无法下注...";
			SendData(bySeatID, cmd.getJsonData());
			return;
		}
		//可以下注，资金先扣除,等待开奖在处理
		this.addBenQiZhuDan(_Uid, needfund, num, data);
		m_pIUserItem[bySeatID].lUserRmb -= needfund;
		SecShmUser user = dthall.getInstance().getSecurityUserInfo(m_pIUserItem[bySeatID].dwUserID);
		user.getRmb1v1(-needfund);
		
		SUBCMD_S_XiaZhuRev cmd = new SUBCMD_S_XiaZhuRev();
		cmd.lUid = _Uid;
		cmd.success = 1;
		cmd.rmb = m_pIUserItem[bySeatID].lUserRmb;
		SendData(bySeatID, cmd.getJsonData());
	}

	public int FindSeat(int _Uid) {
		if(m_allChairs.containsKey(_Uid))
			return m_allChairs.get(_Uid);
		return Constants.INVALID_CHAIR;
	}

	int random(int iMin, int iMax) {
		if (iMax <= iMin || iMax <= 0)
			return 0;
		Random ra = new Random();
		return ra.nextInt(iMax - iMin) + iMin;
	}

	public void memcpy(int[] o, int[] b, int l) {
		for (int i = 0; i < l; i++) {
			o[i] = b[i];
		}
	}

	public int m_DealTime = 0;

	public int getDealTime() {
		return 1000;
	}

	public boolean m_bRemove = false;

	public void DelayRemove() {
		m_bRemove = true;
	}

	public void ResetKillFlag() {
		m_bRemove = false;
	}

	public boolean ShouldBeRemoved() {
		return m_bRemove;
	}

	public void Handle_onLock(Integer lUid, String[] vecArg) {
		if (vecArg.length < 2)
			return;
		if (m_bTableStarted && m_pIUserItem[0].dwUserID == lUid) {
			int index = Constants.atoi(vecArg[1]);
			m_locked = index;

		}
	}

	void Handle_InBack(int _Uid, String vecArg[]) {
		int wChairID = FindSeat(_Uid);
		if (wChairID == Constants.INVALID_CHAIR) {
			return;
		}

		SUBCMD_S_InBack cmd = new SUBCMD_S_InBack();
		cmd.byActionUser = wChairID;
		SendData(Constants.INVALID_CHAIR, cmd.getJsonData());
	}

	void Handle_InFore(int _Uid, String vecArg[]) {
		int wChairID = FindSeat(_Uid);
		if (wChairID == Constants.INVALID_CHAIR) {
			return;
		}

		SUBCMD_S_InFore cmd = new SUBCMD_S_InFore();
		cmd.byActionUser = wChairID;
		SendData(Constants.INVALID_CHAIR, cmd.getJsonData());
	}

	void Handle_GameIap(int _Uid, String vecArg[]) {
		int wChairID = FindSeat(_Uid);
		if (wChairID == Constants.INVALID_CHAIR) {
			return;
		}
		SHMUser user = dthall.getInstance().getUserInfo(_Uid);
		if (user == null) {
			return;
		}
		SUBCMD_S_GameIap cmd = new SUBCMD_S_GameIap();
		cmd.uid = _Uid;
		cmd.seat = wChairID;
		cmd.coin = user.getCoin(0);
		SendData(Constants.INVALID_CHAIR, cmd.getJsonData());
	}
	void Handle_JiShiZhuDan(int _Uid, String vecArg[]){
		int wChairID = FindSeat(_Uid);
		if (wChairID == Constants.INVALID_CHAIR) {
			return;
		}
		SHMUser user = dthall.getInstance().getUserInfo(_Uid);
		if (user == null) {
			return;
		}
		JSONObject rev = new JSONObject();
		rev.put("command", "cqssc_jishi");
		List<String> infos = new ArrayList<String>();
		if(m_benQiZhuDan.containsKey(_Uid)){
			List<JSONObject> datas = m_benQiZhuDan.get(_Uid);
			for(int i = 0;i < datas.size();i++){
				JSONObject json = datas.get(i);
				infos.add(json.toString());
			}
		}
		rev.put("data", infos);
		SendData(wChairID,rev.toString());
	}
	void Handle_TodayYiJie(int _Uid, String vecArg[]){
		int wChairID = FindSeat(_Uid);
		if (wChairID == Constants.INVALID_CHAIR) {
			return;
		}
		SHMUser user = dthall.getInstance().getUserInfo(_Uid);
		if (user == null) {
			return;
		}
		JSONObject rev = new JSONObject();
		rev.put("command", "cqssc_todayyijie");
		List<String> alls = DwcRedisRecord.getInstance().getCqsscTodayYiJie(_Uid);
		rev.put("data", alls);
		SendData(wChairID,rev.toString());
	}
	void Handle_RecordDan(int _Uid, String vecArg[]){
		int wChairID = FindSeat(_Uid);
		if (wChairID == Constants.INVALID_CHAIR) {
			return;
		}
		SHMUser user = dthall.getInstance().getUserInfo(_Uid);
		if (user == null) {
			return;
		}
		long time = Long.parseLong(vecArg[1]);
		Date date = new Date(time * 1000);
		String key = UserRedisInfo.getRecordDayKey(date);
		JSONObject rev = new JSONObject();
		rev.put("command", "cqssc_recorddan");
		rev.put("time",key);
		List<String> alls = DwcRedisRecord.getInstance().getCqsscRecordDan(_Uid,key);
		rev.put("data", alls);
		SendData(wChairID,rev.toString());
	}
	@Override
	public String getRoomInfo() {
		return "";
	}

	public boolean isM_bGameStarted() {
		return m_bGameStarted;
	}

	@Override
	public int getPlayerCount() {
		return GetPlayerCount();
	}

	@Override
	public int getCostGem() {
		return 0;
	}

	@Override
	public int getStatus() {
		if (m_bTableStarted == false) {
			return 0;
		}
		return 1;
	}

	@Override
	public String getRoomDesc() {
		return null;
	}

	@Override
	public int getCellScore() {
		return 0;
	}

	@Override
	public int getMinScore() {
		return 0;
	}

	@Override
	public String getPayway() {
		return m_payWay;
	}

	@Override
	public String GetRoundInfo() {
		return "" + m_byRound + "/" + m_byMaxRound;
	}
}
